﻿@{
    ViewBag.Title = "title";
}
@using AFT.Parking.WebSite.Common
@model AFT.Parking.Foundation.IPagedList<AFT.Parking.Entity.QualityRecord>
@section Head{
    <script type="text/javascript">
        function Delete(id) {
            $.ajax({
                url: "@Url.Action("Delete")",
                data: { id: id },
                success: function(res) {
                    alert("删除成功");
                    $("#tr" + id).remove();
                },
                error: function(res) {
                    alert("删除失败");
                }
            });
        }
    </script>
}

<div class="content-box">
    <!-- Start Content Box -->
    <div class="content-box-header">
        <h3>完成质量记录列表</h3>

        <div class="clear"></div>
    </div>
    <form id="frm">
        <!-- End .content-box-header -->
        <div class="content-box-content">
            <div class="tab-content default-tab" id="tab1">
                <!-- This is the target div. id must match the href of this div's tab -->
                <div class="notification attention png_bg">
                    名称：@Html.TextBox("name", null, new { @class = "searchBox" })
                    <input type="submit" class="button" id="btnSubmit" value="查询" />
                    <div style="display: inline; float: right; margin-right: 20px; margin-top: -6px;">
                        <input type="button" class="button" id="qrcodezip" value="导出二维码" />
                        <input type="button" class="button" id="add" value="新增质量记录" />
                    </div>
                </div>
                <table>
                    <thead>
                        <tr>
                            <th>名称</th>
                            <th>楼栋编号</th>
                            <th>楼层编号</th>
                            <th>栋号长(联系方式)</th>
                            <th>质检员(联系方式)</th>
                            <th>二维码</th>
                            <th>附件</th>
                            <th></th>
                        </tr>
                    </thead>
                    <tfoot>
                        <tr>
                            <td colspan="7">
                                <div class="pagination">
                                    @Html.Pager(Model)
                                </div>
                                <!-- End .pagination -->
                                <div class="clear"></div>
                            </td>
                        </tr>
                    </tfoot>
                    <tbody id="tBodyRows">
                        @foreach (var item in Model.Rows)
                        {
                            <tr id="@("tr" + item.Id)">
                                <td>
                                    @item.Name
                                </td>
                                <td>@item.BuildingNo</td>
                                <td>@item.FloorNo</td>
                                <td>
                                    <span>@item.BuildingMnnager</span>
                                    @if (!string.IsNullOrEmpty(item.BuildingManagerNum))
                                    {
                                        <span> (联系方式:@item.BuildingManagerNum)</span>
                                    }
                                </td>
                                <td>
                                    <span>@item.Inspector</span>
                                    @if (!string.IsNullOrEmpty(item.InspectorNum))
                                    {
                                        <span> (联系方式:@item.InspectorNum)</span>
                                    }
                                </td>
                                <td>
                                    <img src="@item.ImgUrl" style="cursor: pointer;" width="60" height="60" onclick="window.open('@item.ImgUrl')"/>
                                </td>
                                <td style="padding-top: 1px;">
                                    @if (!string.IsNullOrEmpty(item.VerHorizontal))
                                    {
                                        <a style="cursor: pointer; display: block; text-decoration: underline" onclick="window.open('@item.VerHorizontal')">垂平(附件)</a>
                                    }
                                    @if (!string.IsNullOrEmpty(item.SlabThickness))
                                    {
                                        <a style="cursor: pointer; display: block; text-decoration: underline" onclick="window.open('@item.SlabThickness')">楼板厚度(附件)</a>
                                    }
                                    @if (!string.IsNullOrEmpty(item.RoofLevelness))
                                    {
                                        <a style="cursor: pointer; display: block; text-decoration: underline" onclick="window.open('@item.RoofLevelness')">顶板水平度(附件)</a>
                                    }
                                    @if (!string.IsNullOrEmpty(item.Squareness))
                                    {
                                        <a style="cursor: pointer; display: block; text-decoration: underline" onclick="window.open('@item.Squareness')">方正度(附件)</a>
                                    }
                                </td>
                                <td>
                                    <a href="@Url.Action("Register")?id=@item.Id" title="Edit">编辑</a>
                                    <a href="#" onclick="Delete(@item.Id)" title="View">删除</a>
                                </td>
                            </tr>
                        }
                    </tbody>
                </table>
            </div>
            <!-- End #tab1 -->
        </div>
        <!-- End .content-box-content -->
    </form>
</div>
<script>
    $(function() {
        $('#add').click(function () {
            location.href = '@Url.Action("Register")';
        });
        $('#qrcodezip').click(function () {
            window.open('@Url.Action("ZipQrCode")');
        });
    });
</script>
